package cn.edu.sdjzu.xg23.kcsj01_backend.controller;

import cn.edu.sdjzu.xg23.kcsj01_backend.entity.authority.Permission;
import cn.edu.sdjzu.xg23.kcsj01_backend.service.PermissionService;
import cn.edu.sdjzu.xg23.kcsj01_backend.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    /**
     * 获取权限树结构
     */
    @GetMapping("/tree")
    public Result getPermissionTree() {
        List<Permission> permissionTree = permissionService.selectPermissionTree();
        return Result.success(permissionTree);
    }



}